<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 遍历 把数组中的元素全部访问一次
        // 怎么把数组中的元素全部取出 利用循环
        var arr = ['red', 'green', 'blue'];
        for (var i = 0; i < 3; i++) {
            console.log(arr[i]);
        }

        // 练习
        var sanGuo = ['关羽', '张飞', '刘备', '赵云', '黄忠'];
        for (var i = 0; i < 5; i++) {
            console.log(sanGuo[i]);
        }

        // 数组的长度 .length
        var sanGuo1 = ['关羽', '张飞', '刘备', '赵云', '黄忠'];
        for (var i = 0; i < sanGuo1.length; i++) {
            console.log(sanGuo1[i]);
        }
    </script>
</head>

<body>

</body>

</html>